﻿using MoneyManagerNET.DAL.Mock;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using MoneyManagerNET.Model;

namespace Test.DAL.Mock
{
    
    
    /// <summary>
    ///This is a test class for TransactionTest and is intended
    ///to contain all TransactionTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TransactionTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Transaction Constructor
        ///</summary>
        [TestMethod()]
        public void TransactionConstructorTest()
        {
            Transaction target = new Transaction();
            Assert.Inconclusive("TODO: Implement code to verify target");
        }



        Transaction CreateTransfer() {
            BankAccount acc1 = new BankAccount() { Name = "acc1" };
            BankAccount acc2 = new BankAccount() { Name = "acc2" };

            
            Category c = new Category() { Name = "categoriya" };
            SubCategory sc = new SubCategory() { Name="alt categoriya",Category=c};

            Transaction tr = new Transaction()
            {
                FromAccount = acc1,
                ToAccount = acc2,
                Amount = 333,
                Category = c,
                SubCategory = sc
            };

            return tr;
        }

        /// <summary>
        ///A test for DeleteEntity
        ///</summary>
        [TestMethod()]
        public void DeleteEntityTest()
        {
            var tr = CreateTransfer();
            
            var from = tr.FromAccount;
            var from_size = from.WirthdrawList.Count;

            var to = tr.ToAccount;
            var to_size = to.DepositList.Count;


            Transaction.DeleteEntity(tr);

            Assert.IsNull(tr.FromAccount,"deleted transactions FromAccount should be null");
            Assert.IsFalse(from.WirthdrawList.Contains(tr), "deleted transaction should be removed from FromAccount s WirthDrawList");
            Assert.AreEqual(from_size - 1, from.WirthdrawList.Count,"deleted transaction should decrease FromAccount s WirthDrawList count");

            Assert.IsNull(tr.ToAccount, "deleted transactions ToAccount should be null");
            Assert.IsFalse(to.DepositList.Contains(tr), "deleted transaction should be removed from ToAccount s DepositList");
            Assert.AreEqual(to_size - 1, to.DepositList.Count, "deleted transaction should decrease ToAccount s DepositList count");
            
        }

        /// <summary>
        ///A test for Amount
        ///</summary>
        [TestMethod()]
        public void AmountTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            Decimal expected = new Decimal(); // TODO: Initialize to an appropriate value
            Decimal actual;
            target.Amount = expected;
            actual = target.Amount;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for BankAccountId
        ///</summary>
        [TestMethod()]
        public void BankAccountIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.BankAccountId = expected;
            actual = target.BankAccountId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Category
        ///</summary>
        [TestMethod()]
        public void CategoryTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            ICategory expected = null; // TODO: Initialize to an appropriate value
            ICategory actual;
            target.Category = expected;
            actual = target.Category;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for CategoryId
        ///</summary>
        [TestMethod()]
        public void CategoryIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.CategoryId = expected;
            actual = target.CategoryId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Contragent
        ///</summary>
        [TestMethod()]
        public void ContragentTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            IContragent expected = null; // TODO: Initialize to an appropriate value
            IContragent actual;
            target.Contragent = expected;
            actual = target.Contragent;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ContragentId
        ///</summary>
        [TestMethod()]
        public void ContragentIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.ContragentId = expected;
            actual = target.ContragentId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Date
        ///</summary>
        [TestMethod()]
        public void DateTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value
            DateTime actual;
            target.Date = expected;
            actual = target.Date;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for FromAccount
        ///</summary>
        [TestMethod()]
        public void FromAccountTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            IBankAccount expected = null; // TODO: Initialize to an appropriate value
            IBankAccount actual;
            target.FromAccount = expected;
            actual = target.FromAccount;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Id
        ///</summary>
        [TestMethod()]
        public void IdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.Id = expected;
            actual = target.Id;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Notes
        ///</summary>
        [TestMethod()]
        public void NotesTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            target.Notes = expected;
            actual = target.Notes;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for RowVersion
        ///</summary>
        [TestMethod()]
        public void RowVersionTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            DateTimeOffset expected = new DateTimeOffset(); // TODO: Initialize to an appropriate value
            DateTimeOffset actual;
            target.RowVersion = expected;
            actual = target.RowVersion;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Status
        ///</summary>
        [TestMethod()]
        public void StatusTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            byte expected = 0; // TODO: Initialize to an appropriate value
            byte actual;
            target.Status = expected;
            actual = target.Status;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for SubCategory
        ///</summary>
        [TestMethod()]
        public void SubCategoryTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            ISubCategory expected = null; // TODO: Initialize to an appropriate value
            ISubCategory actual;
            target.SubCategory = expected;
            actual = target.SubCategory;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for SubCategoryId
        ///</summary>
        [TestMethod()]
        public void SubCategoryIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.SubCategoryId = expected;
            actual = target.SubCategoryId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ToAccount
        ///</summary>
        [TestMethod()]
        public void ToAccountTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            IBankAccount expected = null; // TODO: Initialize to an appropriate value
            IBankAccount actual;
            target.ToAccount = expected;
            actual = target.ToAccount;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ToAccountId
        ///</summary>
        [TestMethod()]
        public void ToAccountIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.ToAccountId = expected;
            actual = target.ToAccountId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
